<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libslic3r: Slic3r::TriangleMeshSlicer&lt; A &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Slic3r_192px_transparent.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libslic3r
   </div>
   <div id="projectbrief">Library for generating gcode from 3d models</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespace_slic3r.html">Slic3r</a></li><li class="navelem"><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html">TriangleMeshSlicer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="class_slic3r_1_1_triangle_mesh_slicer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Slic3r::TriangleMeshSlicer&lt; A &gt; Class Template Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Class for processing <a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> objects.  
 <a href="class_slic3r_1_1_triangle_mesh_slicer.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_triangle_mesh_8hpp_source.html">TriangleMesh.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:af70436176396fcff786a2cc28b7e51f3"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html#af70436176396fcff786a2cc28b7e51f3">TriangleMeshSlicer</a> (<a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> *_mesh)</td></tr>
<tr class="separator:af70436176396fcff786a2cc28b7e51f3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4ba3bfa8bd19b8b7b9b6d34fad4b9250"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html#a4ba3bfa8bd19b8b7b9b6d34fad4b9250">~TriangleMeshSlicer</a> ()</td></tr>
<tr class="separator:a4ba3bfa8bd19b8b7b9b6d34fad4b9250"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3d6d4e1f0b3f54784243f46ebbc3e3a2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html#a3d6d4e1f0b3f54784243f46ebbc3e3a2">slice</a> (const std::vector&lt; float &gt; &amp;z, std::vector&lt; <a class="el" href="namespace_slic3r.html#ac070ff2d90c6488a48adf1814cdae06c">Polygons</a> &gt; *layers) const</td></tr>
<tr class="separator:a3d6d4e1f0b3f54784243f46ebbc3e3a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8faf3dd797103aba66685691de90e327"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html#a8faf3dd797103aba66685691de90e327">slice</a> (const std::vector&lt; float &gt; &amp;z, std::vector&lt; <a class="el" href="namespace_slic3r.html#a9306b728b4672f5e56abe05ba7437fe1">ExPolygons</a> &gt; *layers) const</td></tr>
<tr class="separator:a8faf3dd797103aba66685691de90e327"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad7b6010f68516cc29fb712f421898dc4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html#ad7b6010f68516cc29fb712f421898dc4">slice</a> (float z, <a class="el" href="namespace_slic3r.html#a9306b728b4672f5e56abe05ba7437fe1">ExPolygons</a> *slices) const</td></tr>
<tr class="separator:ad7b6010f68516cc29fb712f421898dc4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acf33444ff6c496576619746508acd082"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html#acf33444ff6c496576619746508acd082">slice_facet</a> (float slice_z, const stl_facet &amp;facet, const int &amp;facet_idx, const float &amp;min_z, const float &amp;max_z, std::vector&lt; <a class="el" href="class_slic3r_1_1_intersection_line.html">IntersectionLine</a> &gt; *lines, boost::mutex *lines_mutex=NULL) const</td></tr>
<tr class="separator:acf33444ff6c496576619746508acd082"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aec389aab76dc4c1694a08da38202d7b8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html#aec389aab76dc4c1694a08da38202d7b8">cut</a> (float z, <a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> *upper, <a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> *lower) const</td></tr>
<tr class="memdesc:aec389aab76dc4c1694a08da38202d7b8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Splits the current mesh into two parts.  <a href="#aec389aab76dc4c1694a08da38202d7b8">More...</a><br /></td></tr>
<tr class="separator:aec389aab76dc4c1694a08da38202d7b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a17a2625fce7b59bc6f836e1c6e18be5b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html#a17a2625fce7b59bc6f836e1c6e18be5b">mesh</a></td></tr>
<tr class="separator:a17a2625fce7b59bc6f836e1c6e18be5b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;Axis A&gt;<br />
class Slic3r::TriangleMeshSlicer&lt; A &gt;</h3>

<p>Class for processing <a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> objects. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="af70436176396fcff786a2cc28b7e51f3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af70436176396fcff786a2cc28b7e51f3">&#9670;&nbsp;</a></span>TriangleMeshSlicer()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;Axis A&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html">Slic3r::TriangleMeshSlicer</a>&lt; A &gt;::<a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html">TriangleMeshSlicer</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> *&#160;</td>
          <td class="paramname"><em>_mesh</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a4ba3bfa8bd19b8b7b9b6d34fad4b9250"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4ba3bfa8bd19b8b7b9b6d34fad4b9250">&#9670;&nbsp;</a></span>~TriangleMeshSlicer()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;Axis A&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html">Slic3r::TriangleMeshSlicer</a>&lt; A &gt;::~<a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html">TriangleMeshSlicer</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="aec389aab76dc4c1694a08da38202d7b8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aec389aab76dc4c1694a08da38202d7b8">&#9670;&nbsp;</a></span>cut()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;Axis A&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html">Slic3r::TriangleMeshSlicer</a>&lt; A &gt;::cut </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>z</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> *&#160;</td>
          <td class="paramname"><em>upper</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> *&#160;</td>
          <td class="paramname"><em>lower</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Splits the current mesh into two parts. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">z</td><td>Coordinate plane to cut along. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">upper</td><td><a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> object to add the mesh &gt; z. NULL suppresses saving this. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">lower</td><td><a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> object to save the mesh &lt; z. NULL suppresses saving this. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a3d6d4e1f0b3f54784243f46ebbc3e3a2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3d6d4e1f0b3f54784243f46ebbc3e3a2">&#9670;&nbsp;</a></span>slice() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;Axis A&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html">Slic3r::TriangleMeshSlicer</a>&lt; A &gt;::slice </td>
          <td>(</td>
          <td class="paramtype">const std::vector&lt; float &gt; &amp;&#160;</td>
          <td class="paramname"><em>z</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; <a class="el" href="namespace_slic3r.html#ac070ff2d90c6488a48adf1814cdae06c">Polygons</a> &gt; *&#160;</td>
          <td class="paramname"><em>layers</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This method gets called with a list of unscaled Z coordinates and outputs a vector pointer having the same number of items as the original list. Each item is a vector of polygons created by slicing our mesh at the given heights.</p>
<p>This method should basically combine the behavior of the existing Perl methods defined in lib/Slic3r/TriangleMesh.pm:</p>
<ul>
<li>analyze(): this creates the 'facets_edges' and the 'edges_facets' tables (we don't need the 'edges' table)</li>
<li><a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html#acf33444ff6c496576619746508acd082">slice_facet()</a>: this has to be done for each facet. It generates intersection lines with each plane identified by the Z list. The get_layer_range() binary search used to identify the Z range of the facet is already ported to C++ (see Object.xsp)</li>
<li><p class="startli">make_loops(): this has to be done for each layer. It creates polygons from the lines generated by the previous step.</p>
<p class="startli">At the end, we free the tables generated by analyze() as we don't need them anymore.</p>
<p class="startli">NOTE: this method accepts a vector of floats because the mesh coordinate type is float.</p>
</li>
</ul>

</div>
</div>
<a id="a8faf3dd797103aba66685691de90e327"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8faf3dd797103aba66685691de90e327">&#9670;&nbsp;</a></span>slice() <span class="overload">[2/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;Axis A&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html">Slic3r::TriangleMeshSlicer</a>&lt; A &gt;::slice </td>
          <td>(</td>
          <td class="paramtype">const std::vector&lt; float &gt; &amp;&#160;</td>
          <td class="paramname"><em>z</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; <a class="el" href="namespace_slic3r.html#a9306b728b4672f5e56abe05ba7437fe1">ExPolygons</a> &gt; *&#160;</td>
          <td class="paramname"><em>layers</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="ad7b6010f68516cc29fb712f421898dc4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad7b6010f68516cc29fb712f421898dc4">&#9670;&nbsp;</a></span>slice() <span class="overload">[3/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;Axis A&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html">Slic3r::TriangleMeshSlicer</a>&lt; A &gt;::slice </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>z</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespace_slic3r.html#a9306b728b4672f5e56abe05ba7437fe1">ExPolygons</a> *&#160;</td>
          <td class="paramname"><em>slices</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="acf33444ff6c496576619746508acd082"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acf33444ff6c496576619746508acd082">&#9670;&nbsp;</a></span>slice_facet()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;Axis A&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html">Slic3r::TriangleMeshSlicer</a>&lt; A &gt;::slice_facet </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>slice_z</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const stl_facet &amp;&#160;</td>
          <td class="paramname"><em>facet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const int &amp;&#160;</td>
          <td class="paramname"><em>facet_idx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float &amp;&#160;</td>
          <td class="paramname"><em>min_z</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float &amp;&#160;</td>
          <td class="paramname"><em>max_z</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; <a class="el" href="class_slic3r_1_1_intersection_line.html">IntersectionLine</a> &gt; *&#160;</td>
          <td class="paramname"><em>lines</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">boost::mutex *&#160;</td>
          <td class="paramname"><em>lines_mutex</em> = <code>NULL</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="a17a2625fce7b59bc6f836e1c6e18be5b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a17a2625fce7b59bc6f836e1c6e18be5b">&#9670;&nbsp;</a></span>mesh</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;Axis A&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a>* <a class="el" href="class_slic3r_1_1_triangle_mesh_slicer.html">Slic3r::TriangleMeshSlicer</a>&lt; A &gt;::mesh</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/libslic3r/<a class="el" href="_triangle_mesh_8hpp_source.html">TriangleMesh.hpp</a></li>
<li>src/libslic3r/<a class="el" href="_triangle_mesh_8cpp.html">TriangleMesh.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
